package net.butfly.albacore.dao.base;

import net.butfly.albacore.entity.BasicEntity;
import net.butfly.albacore.logger.Logger;
import net.butfly.albacore.logger.LoggerFactory;

import org.mybatis.spring.SqlSessionTemplate;

public abstract class MybatisDAOBase implements MybatisDAO {
	private static final long serialVersionUID = 1L;
	protected final Logger logger = LoggerFactory.getLogger(this.getClass());
	protected SqlSessionTemplate template;
	protected String schema = null;

	@Override
	public void setTemplate(SqlSessionTemplate template) {
		this.template = template;
	}

	protected String getSqlId(Class<? extends BasicEntity<?>> entityClass, String op) {
		return new StringBuilder().append(entityClass.getName()).append(".").append(op).toString();
	}

	protected String getSqlId(Class<? extends BasicEntity<?>> entityClass, String op, String opID) {
		return new StringBuilder().append(entityClass.getName()).append(".").append(op).append(opID).toString();
	}

	public void setSchema(String schema) {
		this.schema = schema;
	}
}
